<me:VBPRULES x:Class="WPFExcelReport.TRVRULES"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL" 
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"
                     xmlns:AP="clr-namespace:WPFExcelReport;assembly=TAPKOPF"  
                     xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                     x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:VBPRULES.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTBoolToVisibilityConverter x:Key="nbv"/>
        <ucd:NOTConverter  x:Key="not"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:VBPRULES.Resources> 
    <StackPanel>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition   Height="Auto"/>
            </Grid.RowDefinitions>
            <WrapPanel  Grid.Row="0">
                <TextBlock Text="{Binding Source={Localization:Translate Word=粗纱:}}" Width="80"/>
                <TextBlock  Grid.Column="1"   Text="{Binding Path=ORDERNUM}"  Visibility="Collapsed"
                            Width="100" HorizontalAlignment="Left"/>
                <TextBlock  Text="{Binding FLOW,ElementName=TV}" Visibility="Collapsed"
                         />
                <AP:TSAP02 KRS="HM"    ARTST="G" 
                      KEY ="{Binding FLOW,ElementName=TV}"   
                       dwAP="{Binding dwAP,ElementName=TV}" 
                       WH="{Binding WH,ElementName=TV}"/>
            </WrapPanel>
        </Grid>
        <WrapPanel>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="80"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                </Grid.RowDefinitions>
                <TextBlock Grid.Column="0" Grid.Row="0" Text="{Binding Source={Localization:Translate Word=粗纱kg:}}"  Width="80"/>
                <TextBlock  Grid.Column="1" Grid.Row="0" Text="{Binding Path=QTYEND}"  
                     HorizontalAlignment="Left" Width="Auto" />
                <TextBlock Grid.Column="0" Grid.Row="1" Text="{Binding Source={Localization:Translate Word=销售单kg:}}"  Width="80"/>
                <TextBlock  Grid.Column="1" Grid.Row="1" Text="{Binding Path=VKPQTY}"  
                     HorizontalAlignment="Left" Width="Auto" />
            </Grid>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="80"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=投料%}}"  Width="80"/>
                <TextBox  Grid.Column="1" Foreground="Red" FontSize="14" Width="60" IsReadOnly="{Binding IsZutei,ElementName=TV}">
                    <TextBox.Text>
                        <Binding Path="R01" ElementName="TV">
                            <Binding.ValidationRules>
                                <ucd:NumberRangeRule Min="1" Max="99" />
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text> 
                </TextBox> 
                <TextBlock Grid.Column="2" Text="{Binding Source={Localization:Translate Word=移走:}}" Foreground="Red" Margin="20,0,0,0"/>
                <Button   Grid.Column="3" Margin="20,0,0,0" Click="ManageCommand" Width="20" Height="20" HorizontalAlignment="Left" 
                     Visibility="{Binding IsMaster,Converter={StaticResource bv}}" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Extend.png" />
                    </Button.Background>
                </Button>
            </Grid>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=原料重量:}}"></TextBlock>
                <TextBlock Grid.Column="1" Text="{Binding Path=QTYMAT}" 
                     HorizontalAlignment="Left" Width="Auto" />
            </Grid>
        </WrapPanel>
        <Grid Visibility="Collapsed">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition   Height="Auto"/>
            </Grid.RowDefinitions>
            <TextBlock Grid.Row="0" Text="{Binding Source={Localization:Translate Word=粗纱交期:}}"  Width="80"/>
            <ex:NumericBox  Grid.Column="1"  Text="{Binding Path=DELDATE}"  
                     Width="100"
                     HorizontalAlignment="Stretch"/>
        </Grid>
        <Grid >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="80"></ColumnDefinition>
                <ColumnDefinition Width="1*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=下单日期:}}"  Width="80"/>
            <ex:NumericBox  Grid.Column="1"  Name="txtDSR"  Width="100" HorizontalAlignment="Left"
                     KeyDown="TextBox_KeyDown" />
        </Grid>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="80"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=周期:}}"  Width="80"/> 
            <ex:NumericBox  Grid.Column="1"   Text="{Binding Path=LEADTIME}" 
                     Width="40" HorizontalAlignment="Left"/>
        </Grid>

        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="80"></ColumnDefinition>
                <ColumnDefinition Width="Auto"></ColumnDefinition> 
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=定量:}}"  Width="80"/>
            <SD:K0015 Grid.Column="1"
                KEY="{Binding TMU,ElementName=TV}"
                ORDERNUM="{Binding TMU,ElementName=TV}"
                />
        </Grid>    
    </StackPanel>
</me:VBPRULES>
